﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Search.aspx.cs" Inherits="DentScan2.WebApp.Search" %>

<%@ Register Src="UC/ucVehicles.ascx" TagName="ucVehicles" TagPrefix="uc1" %>
<%@ Register Src="~/UC/ucRegional.ascx" TagPrefix="uc1" TagName="ucRegional" %>
<%@ Register Src="~/UC/ucDDL.ascx" TagPrefix="uc1" TagName="ucDDL" %>


<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:MultiView runat="server" ID="mvSearch" ActiveViewIndex="0">
        <asp:View runat="server" ID="vSearch">
            <asp:Button runat="server" ID="bSearch" OnClick="bSearch_Click" Text="Търси" />
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" Font-Bold="true" ForeColor="#CC0000" />
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td style="width: 50%; vertical-align: top; text-align: right;" class="lbl">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td>Номер на щета</td>
                                <td>
                                    <asp:TextBox runat="server" ID="tbDamageCode" />
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 150px;">Собственик</td>
                                <td>
                                    <asp:TextBox runat="server" ID="tbName" />
                                </td>
                            </tr>
                            <tr>
                                <td>ЕИК</td>
                                <td>
                                    <asp:TextBox runat="server" ID="tbIdentifier" />
                                </td>
                            </tr>
                            <tr>
                                <td>Експертиза номер</td>
                                <td>
                                    <asp:TextBox runat="server" ID="tbDamageIdentifier" />
                                    <asp:RegularExpressionValidator ID="revDamageIdentifier" ControlToValidate="tbDamageIdentifier" ValidationExpression="[0-9]*" runat="server" ErrorMessage="Експертиза номер: Въведете число" Display="None"></asp:RegularExpressionValidator>

                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <uc1:ucRegional runat="server" ID="ucRegional" CanInsert="false" AddNull="true" MandatoryFields="false" />
                                </td>
                            </tr>
                            <tr>
                                <td>Лице за контакт</td>
                                <td>
                                    <asp:TextBox runat="server" ID="tbContactPerson" />
                                </td>
                            </tr>
                            <tr>
                                <td>Рег. номер</td>
                                <td>
                                    <asp:TextBox runat="server" ID="tbRegNumber" />
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td style="width: 50%; vertical-align: top; text-align: right" class="lbl">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td colspan="2">
                                    <uc1:ucVehicles ID="ucVehicles" runat="server" CanInsert="false" AddNull="true" />
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 150px;">Рама</td>
                                <td>
                                    <asp:TextBox runat="server" ID="tbChassisNumber" />
                                </td>
                            </tr>
                            <tr>
                                <td>Застраховател</td>
                                <td>
                                    <uc1:ucDDL runat="server" ID="ucInsDDL" CanInsert="false" AddNull="true" Classificator="Insurers" />
                                </td>
                            </tr>
                            <tr>
                                <td>Оценител</td>
                                <td>
                                    <uc1:ucDDL runat="server" ID="UcEvaluatorDDL" CanInsert="false" AddNull="true" Classificator="Evaluators" />
                                </td>
                            </tr>
                            <tr>
                                <td>Полица</td>
                                <td>
                                    <asp:TextBox runat="server" ID="tbDocumentNumber" />
                                </td>
                            </tr>

                        </table>
                    </td>
                </tr>
            </table>

            <%--<table border="1" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                <p class="lbl">Собственик</p>
            </td>
            <td>
                <asp:TextBox runat="server" ID="tbName" />
            </td>
            <td rowspan="2" colspan="2">
                <uc1:ucVehicles ID="ucVehicles" runat="server" CanInsert="false" AddNull="true" />
            </td>

        </tr>
        <tr>
            <td>
                <p class="lbl">ЕИК</p>
            </td>
            <td>
                <asp:TextBox runat="server" ID="tbIdentifier" />
            </td>
        </tr>
        <tr>
            <td colspan="2" rowspan="3">
                <uc1:ucRegional runat="server" ID="ucRegional" CanInsert="false" AddNull="true" MandatoryFields="false" />
            </td>
            <td>
                <p class="lbl">Рама</p>
            </td>
            <td>
                <asp:TextBox runat="server" ID="tbChassisNumber" />
            </td>
        </tr>
        <tr>
            <td>
                <p class="lbl">Застраховател</p>
            </td>
            <td>
                <uc1:ucDDL runat="server" ID="ucInsDDL" CanInsert="false" AddNull="true" Classificator="Insurers" />
            </td>
        </tr>
        <tr>
            <td>
                <p class="lbl">Оценител</p>
            </td>
            <td>
                <uc1:ucDDL runat="server" ID="UcEvaluatorDDL" CanInsert="false" AddNull="true" Classificator="Evaluators" />
            </td>
        </tr>
        <tr>
            <td>
                <p class="lbl">Лице за контакт</p>
            </td>
            <td>
                <asp:TextBox runat="server" ID="tbContactPerson" />
            </td>
            <td>
                <p class="lbl">Номер на щета</p>
            </td>
            <td>
                <asp:TextBox runat="server" ID="tbDamageCode" />
            </td>
        </tr>
        <tr>
            <td>
                <p class="lbl">Рег. номер</p>
            </td>
            <td>
                <asp:TextBox runat="server" ID="tbRegNumber" />
            </td>
            <td>
                <p class="lbl">Полица</p>
            </td>
            <td>
                <asp:TextBox runat="server" ID="tbDocumentNumber" />
            </td>
        </tr>
    </table>--%>

            <asp:Button runat="server" ID="bPrev" Text="<<" OnClick="bPrev_Click" />
            <asp:Button runat="server" ID="bNext" Text=">>" OnClick="bNext_Click" />
            <asp:Label runat="server" ID="lRecordCount" Text="" />
            открити записа

    <asp:Repeater runat="server" ID="rResults" OnItemCommand="rResults_ItemCommand">
        <HeaderTemplate>
            <table border="1" cellpadding="0" cellspacing="0">
                <tr>
                    <td></td>
                    <td>
                        <p class="lbl">Марка </p>
                    </td>
                    <td>
                        <p class="lbl">Модел</p>
                    </td>
                    <td>
                        <p class="lbl">Рег. Номер</p>
                    </td>
                    <td>
                        <p class="lbl">Собственик</p>
                    </td>
                    <td>
                        <p class="lbl">Стойност на щетата</p>
                    </td>
                    <td>
                        <p class="lbl">Дата на оценка</p>
                    </td>
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <asp:LinkButton runat="server" ID="lbDel" OnClientClick="return confirm('Моля, потвърдете')" CommandArgument='<%#Eval("DamageId") %>' CommandName="DEL" Text="X" Visible='<%# IsAdmin()%>' />
                    <asp:LinkButton runat="server" ID="lbArchives" CommandArgument='<%#Eval("DamageId") %>' CommandName="ARCHIVES" Text="Архиви" Visible='<%# IsAdmin()%>' />

                </td>
                <td>
                    <a href='Default.aspx?DamageId=<%#Eval("DamageId") %>'>
                        <%#Eval("MakeName") %>
                    </a>
                    <br />
                    <a href='SelectMethod.aspx?CarId=<%#Eval("CarId") %>'>Нова щета на този собственик и автомобил
                    </a>
                    <br />
                    <a href='SelectMethod.aspx?OwnerId=<%#Eval("OwnerId") %>'>Нова щета на този собственик
                    </a>

                </td>
                <td>
                    <%#Eval("ModelName") %>
                </td>
                <td>
                    <%#Eval("RegNumber") %>
                </td>
                <td>
                    <%#Eval("Name") %>
                </td>
                <td>
                    <%#Eval("Total") %>
                </td>
                <td>
                    <%#Eval("ExpertiseDate")!=null?DateTime.Parse(Eval("ExpertiseDate").ToString()).ToShortDateString():"" %>
                </td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>

    </asp:Repeater>

        </asp:View>
        <asp:View runat="server" ID="vArchive">
            <asp:Button runat="server" ID="bBack" Text=".." OnClick="bBack_Click" />
            <asp:Repeater runat="server" ID="rArchive">
                <HeaderTemplate>
                    <table>
                </HeaderTemplate>
                <FooterTemplate>
                    </table>
                </FooterTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <a href='<%#"form.aspx?AUID="+Eval("UID").ToString()+"&Areaid="+Eval("Area").ToString() %>' target="_tab"><%#Eval("date") %></a>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
        </asp:View>

    </asp:MultiView>

</asp:Content>
